/*
 *  Copyright 2019-2020 Zheng Jie
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package me.zhengjie.modules.biz.service.dto;

import lombok.Data;
import me.zhengjie.modules.biz.domain.HazardousChemicals;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;

/**
 * @author Admin
 * @website https://eladmin.vip
 * @description /
 * @date 2023-03-03
 **/
@Data
public class HazardousChemicalsDto implements Serializable {

    private Integer id;

    /**
     * 名称
     */
    private String name;

    /**
     * 危化品类型
     */
    private Integer type;

    /**
     * 危化品数量
     */
    private Float amount;

    /**
     * 存储地点
     */
    private Integer labId;

    /**
     * 备注
     */
    private String note;

    private Timestamp createdAt;

    /**
     * 是否删除
     */
    private Integer isDeleted;

    /**
     * 计数类型
     */
    private Integer countType;

    private Timestamp updatedAt;

    /**
     * 条形码
     */
    private String barCode;

    /**
     * 存放化学品柜
     */
    private Integer cabinetId;

    /**
     * 计量方式
     */
    private Integer measureId;

    /**
     * 危险等级
     */
    private Integer dangerClasses;

    private String labName;

    private String cabinetName;

    private Integer collectNum;

    private Float totalNum;

    private Float capacity;

    private Float weight;

    private Integer status;

    private String index;

    private List<String> projectList;
    private String category;
    private Integer unit;
    private Integer storage;
    private String location;
    private Float residue;//剩余量(仅化学试剂是ml或克的数量，其他都是1)
    private String grade;
    private Integer isAudit;
    private String number;
    private String batchNumber;
    private String matrix;
    private String ingredientData;
    private String attenuation;
    private Timestamp expirationDate;
    private String fileUrl;
    private Integer isApply;

    private String unitStr;//单位描述信息

    //解析数据
    public void parseInfo() {
        if (type == HazardousChemicals.QI_CAI) {
            category = "器材";
            switch (unit) {
                case 1:
                    unitStr = "个";
                    break;
                case 2:
                    unitStr = "台";
                    break;
                case 3:
                    unitStr = "套";
                    break;
            }
        } else if (type == HazardousChemicals.BIAO_ZHUN_WU_ZHI) {
            category = "标准物质";
            switch (unit) {
                case 1:
                    unitStr = "支";
                    break;
                case 2:
                    unitStr = "瓶";
                    break;
            }
        } else if (type == HazardousChemicals.HUA_XUE_SHI_JI) {
            category = "化学试剂";
            switch (unit) {
                case 1:
                    unitStr = "L";//瓶
                    break;
                case 2:
                    unitStr = "mL";//瓶
                    break;
                case 3:
                    unitStr = "g";//瓶
                    break;
            }
        }

    }

}
